package cn.jlonely.xyhx.admin.mapper;

import cn.jlonely.xyhx.pojo.Notification;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NotificationMapper {

    /**
     * 查询所有通知
     * @return
     */
    @Select("select * from notification_table ORDER BY create_time DESC ")
    List<Notification> getNotificationPage();

    /**
     * 删除通知
     * @param id
     */
    @Select("delete from notification_table where id = #{id}")
    void deleteNotification(Integer id);

    /**
     * 创建通知
     * @param notification
     */
    @Insert("INSERT INTO notification_table (content) VALUES (#{content})")
    void createNotification(Notification notification);

}
